package com.pureut.storage.utils;

/*** 
 * 单据类型 枚举类
 * Author:C
 * Date:2022/12/23 15:35
 * @DESC
 */
public enum DocumentTypeEnum {

    /**
     * 采购入库
     */
    PURCHASE_RECEIPT(1, "采购入库"),

    /**
     * 生产领料
     */
    PRODUCTION_PICKING(2, "生产领料"),

    /**
     * 销售发货
     */
    PICKING_SALE(3, "销售发货"),


    /**
     * 委外发货
     */
    PICKING_OUTSOURCE(4, "委外发货"),

    /**
     * 其他出库
     */
    PICKING_REST(5, "其他出库"),

    /**
     * 其他出库
     */
    PICKING_COMPLETE(6, "返工出库"),


    SUBCONTRACT_RECEIPT(7, "委外入库"),
    MISCELLANEOUS_RECEIPT(8, "其他入库"),
    SALES_RETURN(9, "销售退货"),
    PICKING_PURCHASE(10,"采购退货"),


    PRODUCTION_MATERIAL_RETURN(11, "生产退料"),
    WIP_COMPLETION(12, "完工入库"),

    PICKING_RETURNS(13,"委外退货");

    private final int code;
    private final String value;


    DocumentTypeEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    /**
     * 获取 code
     */
    public int getCode() {
        return this.code;
    }

    /**
     * 获取 value
     */
    public String getValue() {
        return this.value;
    }

    /**
     * 获取变量名列表
     */
    public static DocumentTypeEnum[] getVariables() {
        return values();
    }

    /**
     * 根据code获取value
     */
    public static String getValue(int code) {
        for (DocumentTypeEnum myEnums : values()) {
            if (code == myEnums.code) {
                return myEnums.value;
            }
        }
        return "";
    }
}
